<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of BPersonalApp
 *
 * @author jianfeng
 */
class BOnlineQueue extends BServiceApp {

    const operation_MakeQueue = "operationMakeQueue";
    const operation_ProcessQueue = "operationProcessQueue";
    const operation_GetQueueInfo = "operationGetQueueInfo";

    public function addRolesToService($service) {
        
    }

    public function updateApp() {
        
    }

    protected function makeQueue() {
        
    }

    protected function processQueue() {
        
    }

    protected function getQueueInfo() {
        
    }

    protected function init() {
        parent::init();
        $this->setDbAdapter(new BOnlineQueueDbAdapter($this));
    }

    public function doOperation($operationName, $config = NULL) {
        parent::doOperation($operationName, $config);

        if ($operationName == self::operation_MakeQueue)
            return $this->makeQueue();

        if ($operationName == self::operation_ProcessQueue)
            return $this->processQueue();

        if ($operationName == self::operation_GetQueueInfo)
            return $this->getQueueInfo();
    }

    public function getQueueLines($data = array()) {

        $serviceId = isset($data[BAQQueueLine::key_ServiceId]) ? $data[BAQQueueLine::key_ServiceId] : Blyn::app()->getActiveService()->getId();

        $queueLines = BAQQueueLine::findAll(array(BAQQueueLine::key_ServiceId => $serviceId));

        return $queueLines;
    }

}

?>
